<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title><spring:message code="system.edit"/></title>
 	<%@ include file="../../../layout/admin_header.jsp"%>
 	<script src="../../js/articlemanagement.js"></script>
</head>

<body>

    <div id="wrapper">
        <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header"><spring:message code="system.edit"/></h1>
                </div>
            </div>
            <!-- /.row -->
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <spring:message code="system.edit"/>
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-6">
                                    <form role="form" action="edit" method="post">
                                    	<input type="hidden" name="articleid" id="articleid" value="${article.getId()}"/>
                                        <div class="form-group">
                                            <label><spring:message code="article.category"/></label>
                                            <input type="hidden" name="categoryid" id="categoryid" value="${article.getCategoryId()}"/>
                                            <select name="category" id="category" class="form-control">
                                            	<c:forEach var="category" items="${categories}">
	                                                <option id="categoryOpt${category.getId()}" value="${category.getId()}">${category.getName()}</option>
                                                </c:forEach>
                                            </select>
                                        </div>
                                        <div class="form-group">
                                            <label><spring:message code="article.articleTitle"/></label>
                                            <input class="form-control" name="title" id="title" 
                                            value="${article.getTitle()}" placeholder="<spring:message code="article.articleTitle"/>">
                                        </div>
                                        <div class="form-group">
                                            <label><spring:message code="article.summary"/></label>
                                            <input class="form-control" name="summary" id="summary" 
                                            value="${article.getSummary()}" placeholder="<spring:message code="article.summary"/>">
                                        </div>
                                        <div class="form-group">
                                            <label><spring:message code="article.content"/></label>
                                            <textarea class="form-control" name="content" id="content" rows="6" >${article.getContent()}</textarea>
                                        </div>
                                        <div class="form-group">
                                            <label><spring:message code="article.tags"/></label>
                                            <input class="form-control" name="tags" id="tags" 
                                            value="${article.getTag()}" placeholder="<spring:message code="article.tags"/>">
                                        </div>
                                        <div class="form-group">
                                            <label><spring:message code="article.image"/></label>
                                            <input class="form-control" name="image" id="image"
                                            value="${article.getImage()}" placeholder="<spring:message code="article.image"/>">
                                        </div>
                                        <div class="form-group">
                                            <label><spring:message code="article.status"/></label>
                                            <input type="hidden" name="statusHidden" id="statusHidden" value="${article.getActive()}"/>
                                            <select name="status" class="form-control">
                                                <option id="statusOpt1" value="1"><spring:message code="system.active"/></option>
                                                <option id="statusOpt0" value="0"><spring:message code="system.inactive"/></option>
                                            </select>
                                        </div>
                                        <button type="submit" class="btn btn-default"><spring:message code="system.submit"/></button>
                                        <button type="button" onclick="goBack()" class="btn btn-default"><spring:message code="system.cancel"/></button>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script>
	CKEDITOR.replace( 'content' );
</script>
</html>
